{% extends 'shop/base.html' %}

{% block title %}登录{% endblock %}

{% block content %}
<div class="w-1/2 my-6 mx-auto p-6 bg-gray-100 rounded-xl">
    <h1 class="mb-6 text-3xl">Log in</h1>

    <form method="post" action="{% url 'shop:login' %}">
        {% csrf_token %}

        <div class="mb-3">
            <label class="inline-block mb-2">用户名</label><br>
            {{ form.username }}
        </div>

        <div class="mb-3">
            <label class="inline-block mb-2">密码</label><br>
            {{ form.password }}
        </div>

        {% if form.errors or form.non_field_errors %}
            <div class="mb-3 p-6 bg-red-100 rounded-xl">
                {% for field in form %}
                    {{ field.errors }}
                {% endfor %}

                {{ form.non_field_errors }}
            </div>
        {% endif %}

        <button class="py-4 px-8 text-lg bg-teal-500 hover:bg-teal-700 rounded-xl text-white">提交</button>
    </form>
</div>
{% endblock %}
